
<template>
  <div>
    <div class="login f_16 fixedCenter absolute">
      
      <div class="relative pullRight overflowH" style="width:50%;height:100%;" >
        <!-- 1账号+密码 登录 -->
        <Login1 :whoShow="whoShow" @getChildData="childFun"/>
        <!-- 2短信登录 -->
        <Login2 :whoShow="whoShow" :tchaObj="tchaObj" @getChildData="childFun"/>
        <!-- 3忘记密码 -->
        <Login3 :whoShow="whoShow" :tchaObj="tchaObj" @getChildData="childFun"/>
        <!-- 4注册 -->
        <Login4 :whoShow="whoShow" :tchaObj="tchaObj" @getChildData="childFun"/>
      </div>
    </div>
  </div>
</template>



<script>
import Login1 from './_login/login1';//1账号密码
import Login2 from './_login/login2';//2手机短信
import Login3 from './_login/login3';//3忘记密码
import Login4 from './_login/login4';//4注册
import '@$@/_login/css/login.less';

export default {
  name:'login',
  components: {//模块安装
    Login1,Login2,Login3,Login4
  },
  data () {

    let {
      $route:{
        query:{
          zhuce,//企业网站，点击注册跳转进来
          invite_code,//邀请码注册
          unionid//微信扫码绑定
        }
      }
    }=this;

    let whoShow='';
    if($app.judgeData(invite_code)||$app.judgeData(zhuce)){
      whoShow=4;
    }else if($app.judgeData(unionid)){
      whoShow=2;
    }else{
      whoShow=1;
    }

    let data={
      tchaObj:'',//图形验证码 的东西
      whoShow,//模块显示 1账号密码/2手机短信/3忘记密码/4新用户注册
    };
    return data;
  },
  created(){
    //来到这个页面清空所有
    $app.loginOutClear(()=>{
      //初始化$root的数据，避免切换账号的bug
      this.$store.commit('upData_collapsed',false);
    });
    
  },
  methods: {
    childFun(num){
      this.whoShow=num;
      this.tchaFun();
    },
    tchaFun(){
      $ajax.captcha(obj=>{
        this.tchaObj=obj;
      });
    },
  }
}
</script>

<style>

</style>
